package cn.smbms.service.user;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import cn.smbms.dao.user.UserMapper;
import cn.smbms.pojo.User;

@Transactional
@Service("userService")
public class UserServiceImpl implements UserService {
	
	@Autowired
    private UserMapper userMapper;

	@Transactional(propagation=Propagation.SUPPORTS)
    @Override
    public List<User> findUsersWithConditions(User user) {
    	return userMapper.getUserList(user);
    }

	@Override
	public boolean addNewUser(User user) {
		boolean result = false;
		int num = userMapper.add(user);
		if (num>0) {
			result =true;
		}
		//int n = 1/0;
		return result;
	}


}
